<template>
  <div>
    <!-- 顶部 -->
    <el-card>
      <Category @getCategoryId="getCategoryId"> </Category>
    </el-card>
    <!-- 底部 -->
    <el-card style="margin: 20px 0"> 456 </el-card>
  </div>
</template>

<script>
export default {
  name: "Attr",
  data() {
    return {
      // 存储子组件传递过来的数据
      category1Id: "",
      category2Id: "",
      category3Id: "",
    };
  },
  methods: {
    getCategoryId({ id, flag }) {
      // 判断是几id
      switch (flag) {
        case 1:
          this.category1Id =id;
          this.category2Id='';
          this.category3Id=''
          break;
        case 2:
          this.category2Id =id;
          this.category3Id=''
          break;
        case 3:
          this.category3Id=id
          break;
      }
    },
  },
};
</script>

<style>
</style>